-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAPI-654 Add new concat/concat_lc actions to UpsertCondition used by … #64
CAPI-654 Add new concat/concat_lc actions to UpsertCondition used by … #64
Conversation
…ConditionalUpsertProcessorFactory This allows us to support updating a derived field when we do an atomic update of one of the contributing fields
SolrInputDocument onlyPreAndPost = new SolrInputDocument(); | ||
onlyPreAndPost.setField("maybe_prefix", "pre"); | ||
onlyPreAndPost.setField("maybe_suffix", "post"); | ||
assertTrue(condition.matches(null, onlyPreAndPost)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit subtle/weird that this will count as matching, but won't have actually set derived_field
. I guess it might just need calling out a bit more clearly in a comment or something?
I wonder if we need a test to confirm that having multiple rules where the first rule does this behaves as we expect? e.g. only have optional fields for the first rule, but then confirm it does/doesn't interfere with later rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah matching doesn't necessarily imply it will take action, because the condition check is quite a complex boolean ((old.required OR new.required) AND (old.another OR new.another)). It's more of a pre-check for when it could conceivably be relevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect the conditional clauses for using this action would be should
for all the contributing fields, and must_not
for the derived field itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add some tests for when there's multiple UpsertCondition in the overall configuration, to check that subsequent rules do/don't match depending on the outcome of an earlier concat action.
But the other issue, making the conditions accurately match only when the concat action will actually be able to set the derived field, I don't think we can achieve that with the current condition matching logic: it's not expressive enough to handle nested AND/OR conditions that we'd need. Effectively we'd need the condition matching to do the same old/new fallback logic that the action currently implements.
…auses mix with must_not clause
Added a bunch more tests, to check behaviour when multiple conditions are defined and when there's a mix of |
I'm going to merge this as-is and then look at rebasing our stuff onto the new 8.11.3 branch, if it's a smooth transition |
…ConditionalUpsertProcessorFactory
This allows us to support updating a derived field when we do an atomic update of one of the contributing fields